#pragma once
#include "File.h"

struct IFileFactory
{
protected:
    virtual IFile* CreateInstance() = 0;

public:
    bool Create(std::string strFileName)
    {
        IFile* lpIFile = CreateInstance();
        return lpIFile->Create(strFileName);
    }
};

class CTxtFactory : public IFileFactory
{
protected:
    virtual IFile* CreateInstance()
    {
        return new CTxtFile();
    }
};

class CWordFactory : public IFileFactory
{
protected:
    virtual IFile* CreateInstance()
    {
        return new CWordFile();
    }
};
